$(document).ready(function() {
	$.ajax({  
		type : 'POST',  
		url : '/getAllType.do',  
		success : function(datas)  
		{      
			
			for(item in  datas.spectrumtype){	        	 
				$("#spectrumType").append("<option value=" + datas.spectrumtype[item].Id + ">" + datas.spectrumtype[item].spectrumType +"</option>")	        	 
			}	                  
		},  
		error : function()  
		{  
			alert("error");
		}  
	});  
	
});


function particular_message(Id, obj) {
	 $.ajax({  
   	    type : 'POST',  
         url : '/getstandardspectrum.do',  
         data: { "Id": Id }, 
         success : function(datas)  
         {         
           var userId = datas.data[0].userId;          
           var spectrumid = datas.data[0].spectrumId;
           var characteristicPeak = datas.data[0].characteristicPeak;
           var detectedId = datas.data[0].detectedId;
           var spectrumDescription = datas.data[0].spectrumDescription;
           var spectrumTypeId = datas.data[0].spectrumTypeId;
           var spectrumFileUrl = datas.data[0].spectrumFileUrl;
           var spectrumName = datas.data[0].spectrumName;
           var saveTime = datas.data[0].saveTime;
           var categoryOrigin = datas.data[0].categoryOrigin;
           var spectrumPicture = datas.data[0].spectrumPicture;
           var username = datas.username
           var detectedname = datas.detectedname
           var spectrumtype = datas.spectrumtype
          
           $("#username").val(username)
           $("#spectrumid").val(spectrumid)
           $("#spectrumName").val(spectrumName)
           $("#spectrumtype").val(spectrumtype)
           $("#spectrumDescription").val(spectrumDescription)
           $("#savetime").val(saveTime)
           $("#characteristicPeak").val(characteristicPeak)
           $("#detectedname").val(detectedname)
           $("#categoryOrigin").val(categoryOrigin)
           $("#picurl").val(spectrumPicture)
           $("#fileaddress").val(spectrumFileUrl)
         },  
         error : function()  
         {  
         	alert("error");
         }  
     });  
	
}

function get_detected_object(value){
	$.ajax({  
		type : 'POST',  
		url : '/getDetectedByType.do', 
		data: { "spectrumTypeId": value }, 
		success : function(datas)  
		{      
			
			for(item in  datas.standard_spectrum){	        
				$("#detectedID").append("<option value=" + datas.standard_spectrum[item].Id + ">" + datas.detected_object[item].detectedName +"</option>")	      		 	
			}	                  
		},  
		error : function()  
		{  
			alert("error");
		}  
	});  
}

function get_standard_spectrum(value){
	$("#opptionid").val(value)
}